<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>代码生成管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${s.base}/css/base/base.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form">
	<blockquote class="layui-elem-quote quoteBox" id="tool">
			<div class="layui-inline">
				<label class="layui-input-inline">表名称：</label>
				<div class="layui-input-inline">
					<input type="text" class="layui-input" name="tableName" placeholder="请输入表名称" />
				</div>
				<a class="layui-btn search_btn" lay-submit="" lay-filter="seacherBtn">搜索</a>
			</div>
	</blockquote>
	<table id="entityList" lay-filter="entityList"></table>
</form>
<!--操作-->
<script type="text/html" id="entityBar">
	<a class="layui-btn cy-btnbg-add layui-btn-sm"  lay-event="add">生成代码</a>
	<a class="layui-btn cy-btnbg-edit layui-btn-sm"  lay-event="list">列表页面</a>
	<a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="edit">编辑页面</a>
</script>
<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script type="text/javascript" src="${s.base}/js/base/base.js"></script>
<script type="text/javascript">
    layui.use(['jquery','pageUtil','table','baseUtil','dateUtil'],function(){
        var $ = layui.jquery,
            dateUtil = layui.dateUtil,
            table = layui.table,
            baseUtil = layui.baseUtil,
            pageUtil = layui.pageUtil;
			var url="/sysGenerator/page";
			var cols=[
				{type: 'checkbox', fixed: 'left'},
				{type: 'numbers', title: '序号'},
				{field: 'tableName', title: '表名称',align:'center'},
				{field: 'tableComment', title: '表描述',align:'center'},
				{field: 'createTime', title: '创建时间',width:190, align:'center', templet:function(d){
					return dateUtil.formatDate(new Date(d.createTime),"yyyy-MM-dd hh:mm:ss");
				}},
                {field: 'updateTime', title: '修改时间',width:190, align:'center', templet:function(d){
                    return dateUtil.formatDate(new Date(d.createTime),"yyyy-MM-dd hh:mm:ss");
                }},
				{title: '操作',width:280, templet:'#entityBar',align:"center",fixed: 'right'}
			];
			var tableIns = pageUtil.initDate(cols,url,true);
			//监听行工具事件
			table.on('tool(entityList)', function(obj){
				var layEvent = obj.event,
					data = obj.data;
				if(layEvent === 'add'){ //代码生成
                    pageUtil.editPopup("代码生成","/sysGenerator/getEntity?tableName="+data.tableName);
				}else if(layEvent === 'list'){ //列表页面生成
                    parent.tabAddUrl("/sysGenerator/getCreateListPage?tableName="+data.tableName,data.tableName+"表列表页面");
				}else if(layEvent === 'edit'){ //删除
                    parent.tabAddUrl("/sysGenerator/getCreateEditPage?tableName="+data.tableName,data.tableName+"表编辑页面");
                }
			});

    })
</script>
</body>
</html>